local outpath "$path_pch/Output/Figures"

use "$path_pch/Data/intermediate/Saia/saia_simul_results", clear

preserve
	keep if RInum==0
	local c3_ri0 = c3_coef
	local c6_ri0 = c6_coef
restore

drop if mi(RInum) | RInum == 0

count if c3_p > 0.05
count if c6_p > 0.05

count if abs(c3_coef) > abs(`c3_ri0')
local rip_c3 = string(r(N) / _N,"%5.2f")
count if abs(c6_coef) > abs(`c6_ri0')
local rip_c6 = string(r(N) / _N,"%5.2f")

graph twoway (hist c3_coef, start(0) width(0.01) fcolor(538b) lcolor(black%0) lstyle(none) frac) ///
	(scatteri 0 `c3_ri0' 0.2 `c3_ri0', c(l) m(i)), legend(off) title("(a) Table 4, Col 3 (RI p-val=`rip_c3')", size(vlarge)) nodraw name(g3, replace)
graph twoway (hist c6_coef, start(0) width(0.01) fcolor(538b) lcolor(black%0) lstyle(none) frac) ///
	(scatteri 0 `c6_ri0' 0.2 `c6_ri0', c(l) m(i)), legend(off) title("(b) Table 4, Col 6 (RI p-val=`rip_c6')", size(vlarge)) nodraw name(g6, replace)

graph combine g3 g6, col(2) xsize(10) ysize(5) l2("Fraction", size(large)) b2("Coefficient on Divergent Peers", size(large))

graph export "`outpath'/saia_simul_figC1.png", replace width(2000) height(1000)
